var _n7;
var cc__extends = __extends;
var cc__decorate = __decorate;
var cc__importDefault = __importDefault;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $1$http_request = require("http_request");
var s = cc__importDefault($1$http_request);
var $1$userService = require("userService");
var c = cc__importDefault($1$userService);
var $1$zqcc_pageBase = require("zqcc_pageBase");
var l = cc__importDefault($1$zqcc_pageBase);
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_Fuwu = function (t) {
  function _ctor() {
    const instance = null !== t && t.apply(this, arguments) || this;
    instance.tishiLabel = null; // 初始化提示标签为null
    instance.url = "https://changshazhise01-1254961065.cos.ap-guangzhou.myqcloud.com/zhise/oppo/agreement.json"; // 设置URL
    return instance; // 返回实例
  }
  cc__extends(_ctor, t);
  _ctor.prototype.onLoad = function () { };
  _ctor.prototype.start = function () {
    s.default.getInstance().get(this.url, null, this.show.bind(this));
  };
  _ctor.prototype.show = function (t) {
    console.log(t);
    const context = this; // 使用const替代var
    const data = t; // 更具描述性的变量名
    let formattedText = ""; // 使用let，避免在每一层作用域中重新声明

    for (const key in data) { // 使用const和更具描述性的变量名
      if (Object.prototype.hasOwnProperty.call(data, key)) {
        const item = data[key]; // 更具描述性的变量名
        let textContent = ""; // 使用let声明
        if (item.style && item.style.bold) {
          if (Array.isArray(item.test)) { // 更简洁的数组判断
            textContent = "<b>" + item.test.join("") + "</b"; // 直接使用join创建字符串
          } else {
            textContent = "<b>" + item.text + "</b>";
          }
        } else if (Array.isArray(item.test)) {
          textContent = item.test.join(""); // 直接使用join创建字符串
        } else {
          textContent = item.text; // 直接使用item.text
        }
        formattedText += textContent; // 累计文本内容
      }
    }

    // 替换占位符
    formattedText = formattedText
      .replace(/company/gi, context.default.vivoSDKdata.zs_company)
      .replace(/email/gi, "email:" + context.default.vivoSDKdata.zs_postbox)
      .replace(/app_name/gi, context.default.vivoSDKdata.zs_game_name);

    // 更新提示标签
    context.tishiLabel.string = formattedText;

    // 调整节点的高度
    context.scheduleOnce(function () {
      context.tishiLabel.node.parent.height = context.tishiLabel.node.height;
    });
  };
  cc__decorate([ccp_property(cc.RichText)], _ctor.prototype, "tishiLabel", undefined);
  return cc__decorate([ccp_ccclass], _ctor);
}(l.default);
exports.default = def_Fuwu;